
// OvtItemGen.h : main header file for the PROJECT_NAME application
//

#pragma once

#ifndef __AFXWIN_H__
	#error "include 'stdafx.h' before including this file for PCH"
#endif

#include "resource.h"		// main symbols


// COvtItemGenApp:
// See OvtItemGen.cpp for the implementation of this class
//

class COvtItemGenApp : public CWinApp
{
public:
	COvtItemGenApp();

	static CString m_strAppPath;

// Overrides
public:
	virtual BOOL InitInstance();

// Implementation

	DECLARE_MESSAGE_MAP()
};

extern COvtItemGenApp theApp;

__inline CString GetErrorString(/*LPCSTR linedesc, LPCSTR filename, int lineno,*/ DWORD errnum)
{
	

	LPSTR lpBuffer;
#if 0
	//TCHAR errbuf[256];
#ifdef _WINDOWS
	TCHAR modulename[MAX_PATH];
#else // _WINDOWS
	DWORD numread;
#endif // _WINDOWS
#endif
	FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
		NULL,
		errnum,
		LANG_NEUTRAL,
		(LPTSTR)&lpBuffer,
		0,
		NULL);
	CString strRet = (TCHAR*)lpBuffer;
#if 0
	wsprintf(errbuf, _T("\nThe following call failed at line %d in %s:\n\n    %s\n\nReason: %s\n")
		, lineno, filename, linedesc, lpBuffer);

#ifndef _WINDOWS
	WriteFile(GetStdHandle(STD_ERROR_HANDLE), errbuf, strlen(errbuf), &numread, FALSE);
	Sleep(3000);
#else
	GetModuleFileName(NULL, modulename, MAX_PATH);
	MessageBox(NULL, errbuf, modulename, MB_ICONWARNING|MB_OK|MB_TASKMODAL|MB_SETFOREGROUND);
#endif
#endif
	LocalFree((LPVOID)lpBuffer);
//	exit(EXIT_FAILURE);
	return strRet;
}